<?php

namespace app\api\controller\points;

use app\api\controller\Controller;
use app\api\model\points\Category as CategoryModel;

/**
 * 积分商城商品分类控制器
 * Class Category
 * @package app\api\controller\points
 */
class Category extends Controller
{
    /**
     * 积分商城积分分类
     * @return array
     * @throws \think\exception\DbException
     */
    public function points()
    {
        // 商品分类列表
        $list = array_values(CategoryModel::getPointsALL());
        array_unshift($list,['category_id' => 0, 'name' => '全部']);
        return $this->renderSuccess(compact('list'));
    }

    /**
     * 积分商城返现劵分类
     * @return array
     * @throws \think\exception\DbException
     */
    public function coupon()
    {
        // 商品分类列表
        $list = array_values(CategoryModel::getCouponALL());
        array_unshift($list,['category_id' => 0, 'name' => '全部']);
        return $this->renderSuccess(compact('list'));
    }

}
